package com.gmail.avereshchaga.db.service;

import com.gmail.avereshchaga.db.dao.IItemDAO;
import com.gmail.avereshchaga.db.entity.IItem;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 *
 * @author <a href="mailto:avereshchaga@gmail.com">Vereshchaga Alexey</a>
 */
@Service
public class ItemServiceImpl implements IItemService {

    @Autowired
    private IItemDAO itemDAO;

    @Transactional
    @Override
    public void updateItem(IItem item) {
        itemDAO.updateItem(item);
    }

    @Transactional
    @Override
    public void deleteItem(Long id) {
        itemDAO.deleteItem(id);
    }

    @Transactional
    @Override
    public List<IItem> findAll(Integer page) {
        return itemDAO.findAll(page);
    }

    @Transactional
    @Override
    public IItem findById(Long id) {
        return itemDAO.findById(id);
    }

    @Transactional
    @Override
    public List<IItem> findByFilter(String code, String name, Date date, String username, Integer page) {
        return itemDAO.findByFilter(code, name, date, username, page);
    }
}
